<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>vue</title>
    <script type="text/javascript" src="../../js/vue.js"></script>

</head>
<body>
    <div id="root">
        <h5>测试{{name}}</h5>
        <!-- 键盘事件 keydown keyup -->
        <!-- 
        回车 enter --13
        删除 delete 包含删除和退格
        退出 esc
        空格 space
        换行 tab 必须配置 keydown
        上 up 下 down 左left 右right

        字母小写，多个单词用-连接

        @keyup.ctrl.y="showInfo"  ctrl+y才生效
     -->
        <input type="text" placeholder="按下回车提示输入" @keyup="showInfo">
    </div>

    <script type="text/javascript">
        Vue.config.performance = false;

        const vm = new Vue({
            el:'#root',
            data() {
                return {
                  name:'zw'
                };
            },
            methods:{
                showInfo(e){
                    console.log(e.target.value)
                    console.log(e.keyCode,e.key)
                
                }
            }
        })

    </script>

</body>
</html>